package cn.iocoder.yudao.module.shop.dal.mysql.priceitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.shop.dal.dataobject.priceitem.ShopPriceItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.shop.controller.admin.priceitem.vo.*;

/**
 * 价格单项 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopPriceItemMapper extends BaseMapperX<ShopPriceItemDO> {

    default PageResult<ShopPriceItemDO> selectPage(ShopPriceItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopPriceItemDO>()
                .eqIfPresent(ShopPriceItemDO::getPriceId, reqVO.getPriceId())
                .eqIfPresent(ShopPriceItemDO::getItemId, reqVO.getItemId())
                .betweenIfPresent(ShopPriceItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopPriceItemDO::getId));
    }

    default List<ShopPriceItemDO> selectList(ShopPriceItemExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopPriceItemDO>()
                .eqIfPresent(ShopPriceItemDO::getPriceId, reqVO.getPriceId())
                .eqIfPresent(ShopPriceItemDO::getItemId, reqVO.getItemId())
                .betweenIfPresent(ShopPriceItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopPriceItemDO::getId));
    }

}
